<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">


<ui:composition template="/templates/templateProfessor.xhtml">
	<ui:define name="conteudo">
		<h:outputText value="Bem vindo: " />
		<h:outputText value="#{mBIndexProfessor.professor.usuario.nome}" />
		        
		<h:form>
		<p:dataTable value="#{mBIndexProfessor.professor.aulas}" var="aula">
			<p:column headerText="Escola">
			<p:commandLink value="#{aula.turma.escola.nome}" oncomplete="escolaDialog.show()" update="@form">
				<f:setPropertyActionListener target="#{mBEscola.escolaVisualizacao}" value="#{escola}"></f:setPropertyActionListener>
			</p:commandLink>
			</p:column>
			
			<p:column headerText="Turma">
					<p:commandLink value="#{aula.turma.nome}" oncomplete="turmaDialog.show()" action="#{mBTurma.setarTurmaDialog}" update="@form">
						<f:setPropertyActionListener target="#{mBTurma.turmaVisualizacao}" value="#{aula.turma}"/>
					</p:commandLink>
			</p:column>
			
			<p:column headerText="Disciplina">
				<p:commandLink value="#{aula.disciplina.nome}" oncomplete="disciplinaDialog.show()" update="@form">
						<f:setPropertyActionListener target="#{mBDisciplina.disciplinaVisualizacao}" value="#{aula.disciplina}"></f:setPropertyActionListener>
					</p:commandLink>
			</p:column>
			
			<p:column headerText="Horario">
				#{aula.horario}
			</p:column>
			
			<p:column headerText="Acessar">
				<p:commandButton value="Acessar Turma" action="#{mBIndexProfessor.irTurma}" ajax="false">
					<f:setPropertyActionListener target="#{mBIndexProfessor.idIrAula}" value="#{aula.id}"/>
				</p:commandButton>
			</p:column>
			
		</p:dataTable>
		<p:dialog widgetVar="escolaDialog" header="Escola">
				<ui:include src="../comum/escola.xhtml">
					<ui:param name="escola" value="#{mBEscola.escolaVisualizacao}"/>
				</ui:include>
			</p:dialog>
			<p:dialog widgetVar="disciplinaDialog" header="Disciplina">
				<ui:include src="../comum/disciplina.xhtml">
					<ui:param name="disciplina" value="#{mBDisciplina.disciplinaVisualizacao}"/>
				</ui:include>
			</p:dialog>
			<p:dialog widgetVar="turmaDialog" header="Turma">
				<ui:include src="../comum/turma.xhtml">
					<ui:param name="turma" value="#{mBTurma.turmaVisualizacao}"/>
				</ui:include>
			</p:dialog>
		</h:form>
	</ui:define>
</ui:composition>
</html>